#include <iostream>
#include <vector>
#include <queue>
using namespace std;
struct cmp{
	bool operator() (const int& p1,const int& p2){
		return p1>p2;
	}
};
int schedule(vector<int> tasks,int num_machines){
	
	priority_queue<int,vector<int>,cmp> q;
	int nRet=0;
	for(int i=0;i<num_machines;++i){
		q.push(0);
	}
	for(int i=0;i<tasks.size();++i){
		int u=q.top();
		q.pop();
		u+=tasks[i];
		q.push(u);
	}
	while(q.size()){
		int u=q.top();
		q.pop();
		nRet=max(nRet,u);
	}
	
	return nRet;
}
